<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>SPHinXsys: SPHINXsys/src/for_3D_build/meshes/cell_linked_list.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">SPHinXsys
   &#160;<span id="projectnumber">alpha version</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_3dc1dabd28ba78e072d14d3fcfc90454.html">SPHINXsys</a></li><li class="navelem"><a class="el" href="dir_48ea983704c43b6d88c1fa3f4d09e369.html">src</a></li><li class="navelem"><a class="el" href="dir_836a4ac91a086ae3266ddeefe87700e6.html">for_3D_build</a></li><li class="navelem"><a class="el" href="dir_34f1ea4b19dfac3aee1f14ed8e64a572.html">meshes</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">cell_linked_list.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#pragma once</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;</div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="base__particles_8h.html">base_particles.h</a>&quot;</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="base__kernel_8h.html">base_kernel.h</a>&quot;</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="cell__linked__list_8h.html">cell_linked_list.h</a>&quot;</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;</div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespace_s_p_h.html">SPH</a></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;{</div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;    <span class="comment">//=================================================================================================//</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;    <span class="keyword">template</span>&lt;<span class="keyword">typename</span> GetParticleIndex, <span class="keyword">typename</span> GetSearchDepth, <span class="keyword">typename</span> GetNeighborRelation&gt;</div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="class_s_p_h_1_1_cell_linked_list.html#a7e64816386ad8a4c72cf3cd3b8a9abec">CellLinkedList::searchNeighborsByParticles</a>(<span class="keywordtype">size_t</span> total_real_particles, BaseParticles&amp; source_particles,</div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;            <a class="code" href="namespace_s_p_h.html#a720b2214c518c3299a6d4895dacddc50">ParticleConfiguration</a>&amp; particle_configuration, GetParticleIndex&amp; get_particle_index,</div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;            GetSearchDepth&amp; get_search_depth, GetNeighborRelation&amp; get_neighbor_relation)</div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;    {</div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;        parallel_for(blocked_range&lt;size_t&gt;(0, total_real_particles),</div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;            [&amp;](<span class="keyword">const</span> blocked_range&lt;size_t&gt;&amp; r) {</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;                <a class="code" href="class_std_large_vec_3_01_vecd_01_4.html">StdLargeVec&lt;Vecd&gt;</a>&amp; pos_n = source_particles.pos_;</div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;                <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> num = r.begin(); num != r.end(); ++num) {</div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;                    <span class="keywordtype">size_t</span> index_i = get_particle_index(num);</div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;                    <a class="code" href="class_vecd.html">Vecd</a>&amp; particle_position = pos_n[index_i];</div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;                    <span class="keywordtype">int</span> search_depth = get_search_depth(index_i);</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;                    Vecu target_cell_index = CellIndexFromPosition(particle_position);</div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;                    <span class="keywordtype">int</span> i = (int)target_cell_index[0];</div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;                    <span class="keywordtype">int</span> j = (int)target_cell_index[1];</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;                    <span class="keywordtype">int</span> k = (int)target_cell_index[2];</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;                    Neighborhood&amp; neighborhood = particle_configuration[index_i];</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;                    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> l = SMAX(i - search_depth, 0); l &lt;= SMIN(i + search_depth, <span class="keywordtype">int</span>(<a class="code" href="class_s_p_h_1_1_mesh.html#a8996ae22420ea203e1206c2c7466d716">number_of_cells_</a>[0]) - 1); ++l)</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;                        <span class="keywordflow">for</span> (<span class="keywordtype">int</span> m = SMAX(j - search_depth, 0); m &lt;= SMIN(j + search_depth, <span class="keywordtype">int</span>(<a class="code" href="class_s_p_h_1_1_mesh.html#a8996ae22420ea203e1206c2c7466d716">number_of_cells_</a>[1]) - 1); ++m)</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;                            <span class="keywordflow">for</span> (<span class="keywordtype">int</span> q = SMAX(k - search_depth, 0); q &lt;= SMIN(k + search_depth, <span class="keywordtype">int</span>(<a class="code" href="class_s_p_h_1_1_mesh.html#a8996ae22420ea203e1206c2c7466d716">number_of_cells_</a>[2]) - 1); ++q)</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;                            {</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;                                <a class="code" href="namespace_s_p_h.html#ace86b54c9f5761532f28d4ffc0dad8ff">ListDataVector</a>&amp; target_particles = <a class="code" href="class_s_p_h_1_1_cell_linked_list.html#a5d02f0a9b0c0d8f21828c78f9e145d0a">cell_linked_lists_</a>[l][m][q].cell_list_data_;</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;                                <span class="keywordflow">for</span> (<span class="keyword">const</span> <a class="code" href="namespace_s_p_h.html#a7fbc15167459a37683f40cb4a5aa0f06">ListData</a>&amp; list_data : target_particles)</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;                                {</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;                                    <span class="comment">//displacement pointing from neighboring particle to origin particle</span></div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;                                    <a class="code" href="class_vecd.html">Vecd</a> displacement = particle_position - list_data.second;</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;                                    get_neighbor_relation(neighborhood, displacement, index_i, list_data.first);</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;                                }</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;                            }</div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;                }</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;            }, ap);</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;    }</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;    <span class="comment">//=================================================================================================//</span></div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;}</div><div class="ttc" id="class_s_p_h_1_1_mesh_html_a8996ae22420ea203e1206c2c7466d716"><div class="ttname"><a href="class_s_p_h_1_1_mesh.html#a8996ae22420ea203e1206c2c7466d716">SPH::Mesh::number_of_cells_</a></div><div class="ttdeci">Vecu number_of_cells_</div><div class="ttdef"><b>Definition:</b> base_mesh.h:110</div></div>
<div class="ttc" id="cell__linked__list_8h_html"><div class="ttname"><a href="cell__linked__list_8h.html">cell_linked_list.h</a></div><div class="ttdoc">Here gives the classes for managing cell linked lists. This is the basic class for building the parti...</div></div>
<div class="ttc" id="class_std_large_vec_3_01_vecd_01_4_html"><div class="ttname"><a href="class_std_large_vec_3_01_vecd_01_4.html">StdLargeVec&lt; Vecd &gt;</a></div></div>
<div class="ttc" id="class_s_p_h_1_1_cell_linked_list_html_a5d02f0a9b0c0d8f21828c78f9e145d0a"><div class="ttname"><a href="class_s_p_h_1_1_cell_linked_list.html#a5d02f0a9b0c0d8f21828c78f9e145d0a">SPH::CellLinkedList::cell_linked_lists_</a></div><div class="ttdeci">MeshDataMatrix&lt; CellList &gt; cell_linked_lists_</div><div class="ttdef"><b>Definition:</b> cell_linked_list.h:118</div></div>
<div class="ttc" id="namespace_s_p_h_html_ace86b54c9f5761532f28d4ffc0dad8ff"><div class="ttname"><a href="namespace_s_p_h.html#ace86b54c9f5761532f28d4ffc0dad8ff">SPH::ListDataVector</a></div><div class="ttdeci">StdLargeVec&lt; ListData &gt; ListDataVector</div><div class="ttdef"><b>Definition:</b> sph_data_containers.h:44</div></div>
<div class="ttc" id="namespace_s_p_h_html_a720b2214c518c3299a6d4895dacddc50"><div class="ttname"><a href="namespace_s_p_h.html#a720b2214c518c3299a6d4895dacddc50">SPH::ParticleConfiguration</a></div><div class="ttdeci">StdLargeVec&lt; Neighborhood &gt; ParticleConfiguration</div><div class="ttdef"><b>Definition:</b> neighbor_relation.h:66</div></div>
<div class="ttc" id="namespace_s_p_h_html_a7fbc15167459a37683f40cb4a5aa0f06"><div class="ttname"><a href="namespace_s_p_h.html#a7fbc15167459a37683f40cb4a5aa0f06">SPH::ListData</a></div><div class="ttdeci">std::pair&lt; size_t, Vecd &gt; ListData</div><div class="ttdef"><b>Definition:</b> sph_data_containers.h:42</div></div>
<div class="ttc" id="base__particles_8h_html"><div class="ttname"><a href="base__particles_8h.html">base_particles.h</a></div><div class="ttdoc">This is the base class of SPH particles. The basic data of the particles is saved in separated large ...</div></div>
<div class="ttc" id="class_vecd_html"><div class="ttname"><a href="class_vecd.html">Vecd</a></div></div>
<div class="ttc" id="base__kernel_8h_html"><div class="ttname"><a href="base__kernel_8h.html">base_kernel.h</a></div><div class="ttdoc">This is the base classes of kernel functions. Implementation will be implemented in derived classes...</div></div>
<div class="ttc" id="class_s_p_h_1_1_cell_linked_list_html_a7e64816386ad8a4c72cf3cd3b8a9abec"><div class="ttname"><a href="class_s_p_h_1_1_cell_linked_list.html#a7e64816386ad8a4c72cf3cd3b8a9abec">SPH::CellLinkedList::searchNeighborsByParticles</a></div><div class="ttdeci">void searchNeighborsByParticles(size_t total_real_particles, BaseParticles &amp;source_particles, ParticleConfiguration &amp;particle_configuration, GetParticleIndex &amp;get_particle_index, GetSearchDepth &amp;get_search_depth, GetNeighborRelation &amp;get_neighbor_relation)</div><div class="ttdef"><b>Definition:</b> cell_linked_list.hpp:16</div></div>
<div class="ttc" id="namespace_s_p_h_html"><div class="ttname"><a href="namespace_s_p_h.html">SPH</a></div><div class="ttdef"><b>Definition:</b> solid_body_supplementary.cpp:9</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>
